from django.shortcuts import render
from . import *
from django.http import HttpRequest
from index.utils import success, error
from django.http import StreamingHttpResponse
from django.http.response import HttpResponse


def search_fund(request: HttpRequest):
    data = search(request.json.get("keyword"))
    return success(data)


def filter_fund(request: HttpRequest):
    data = filter_(**dict(request.json.items()))
    return success(data)


def fund_detail(request: HttpRequest):
    data = detail(request.json.get("code"))
    return success(data)


def fund_jzgs_pic(request: HttpRequest):
    data = get_picture(request.json.get("code"))
    return HttpResponse(data, content_type="image/png")


def fund_jz_pic(request: HttpRequest):
    data = get_jz_picture(request.json.get("code"))
    return HttpResponse(data, content_type="image/png")


def js_data(request: HttpRequest):
    data = get_js_data(request.json.get("code"))
    return HttpResponse(data, content_type="application/javascript")


def ljsylzs(request: HttpRequest):
    data = get_ljsylzs(**dict(request.json.items()))
    return success(data)


def jbxx(request: HttpRequest):
    data = get_jbxx(**dict(request.json.items()))
    return success(data)


def yjpjbj(request: HttpRequest):
    data = get_yjpjbj(**dict(request.json.items()))
    return success(data)


def ljsyl(request: HttpRequest):
    data = get_ljsyl(**dict(request.json.items()))
    return success(data)
